package com.hb.unic.core.ioc;

import java.util.Collection;

import org.springframework.stereotype.Component;

import com.hb.unic.core.context.Application;
import com.hb.unic.core.context.handler.IAfterStartupHandler;
import com.hb.unic.core.context.event.StartupEventArgs;

/**
 * 自身注入处理器
 *
 * @since v1.0，2023/8/27 13:49，create by Mr.Huang.
 */
@Component
@SuppressWarnings({"all"})
public class SelfInjectHandler implements IAfterStartupHandler {

    @Override
    public void execute(StartupEventArgs eventArgs) {
        Collection<ISelfInject> beans = Application.getContext().getBeanList(ISelfInject.class);
        beans.forEach(bean -> bean.setSelf(bean));
    }

}
